/*
 * Comparing while-loops, do-loops, and for-loops
 * Suggested exercises:
 * - Move the index increment in the beginning of the while and do loops, explain the difference
 * - Print the squares from 0 to 100 with increments of 5
 * - Use user specified range and increment
 */

public class Loops
{
    public static void main (String[] args)
    {
        int i;
        
     // While loop - leading decision (pretest)
        i = 1;
        while (i<=10)
        {
            System.out.println(i + "^2 = " + i*i);
            i++;            
        }
        
        System.out.println();

        // Do loop - trailing decision (posttest)
        i = 1;      
        do
        {
            System.out.println(i + "^2 = " + i*i);
            i++;

        } while (i<=10);
        
        System.out.println();
        
     // For loop
        for (i = 1; i<=10; i++)
        {
            System.out.println(i + "^2 = " + i*i);
        }
        
        System.out.println();

    }
}
